package com.chixing.day03_oop;

public class Person {
    private String personName;
    private int personAge;
    private String personGender;
    private String personMarry;

    public String getPersonName() {
        return personName;
    }

    public void setPersonName(String personName) {
        this.personName = personName;
    }

    public int getPersonAge() {
        return personAge;
    }

    public void setPersonAge(int personAge) {
        this.personAge = personAge;
    }

    public String getPersonGender() {
        return personGender;
    }

    public void setPersonGender(String personGender) {
        this.personGender = personGender;
    }

    public String getPersonMarry() {
        return personMarry;
    }

    public void setPersonMarry(String personMarry) {
        this.personMarry = personMarry;
    }

    public boolean canMarry(Person another){
        if(another == null ||  another == this)
            return false;
        if (another.personMarry == "已婚"||this.personMarry == "已婚")
            return false;
        if (another.personGender == this.personGender)
            return false;
        if (another.personGender=="男"&&another.personAge>=24&&this.personAge>=22||
        another.personGender=="女"&&another.personAge>=22&&this.personAge>=24)
            return true;
        return false;
    }

}
